package com.ez.supervise.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ez.supervise.core.Page;
import com.ez.supervise.dao.OrgDemocracyDao;
import com.ez.supervise.dao.base.BaseDaoImpl;
import com.ez.supervise.model.biz.OrgDemocracy;

public class OrgDemocracyDaoImpl extends BaseDaoImpl implements OrgDemocracyDao {
    @Override
    public void insert(Object orgDemocracy) {
	sqlMapClientTemplate.insert("biz.insertOrgDemocracy", orgDemocracy);
    }

    public Object get(Long id) {
	return (OrgDemocracy) sqlMapClientTemplate.queryForObject("biz.getOrgDemocracyById", id);
    }

    public void update(Object org) {
	sqlMapClientTemplate.update("biz.updateOrgDemocracy", org);
    }

    public void delete(Long id) {
	sqlMapClientTemplate.update("biz.deleteOrgDemocracy", id);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.dao.OrgDemocracyDao#findByCount(com.ez.supervise.core.Page)
     */
    public int findByCount(Page page) {
	return (Integer) getSqlMapClientTemplate().queryForObject("biz.findOrgDemocracyByCount", page);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.dao.OrgDemocracyDao#findByPage(com.ez.supervise.core.Page)
     */
    public List findByPage(Page page) {
	return getSqlMapClientTemplate().queryForList("biz.findOrgDemocracyByPage", page);
    }

    /*
     * (non-Javadoc)
     * 
     * @see com.ez.supervise.dao.OrgDemocracyDao#findAll()
     */
    public List findAll() {
	return getSqlMapClientTemplate().queryForList("biz.findAllOrgDemocracy");
    }


    /* (non-Javadoc)
     * @see com.ez.supervise.dao.OrgDemocracyDao#saveOrgDemocracy(java.util.List)
     */
    public void saveOrgDemocracy(List<OrgDemocracy> dataList) {
    }

    /* (non-Javadoc)
     * @see com.ez.supervise.dao.OrgDemocracyDao#queryDemocracy(java.lang.Integer, java.lang.String, java.lang.String, java.lang.Long)
     */
    public List queryDemocracy(Integer year, String orgType, String queryType, Long checkManId) {
	Map map = new HashMap();
	map.put("year", year);
	map.put("orgType", orgType);
	map.put("queryType", queryType);
	map.put("checkManId", checkManId);
	return getSqlMapClientTemplate().queryForList("biz.queryDemocracy", map);
    }

    /* (non-Javadoc)
     * @see com.ez.supervise.dao.OrgDemocracyDao#countOrgDemocracy(java.lang.Integer, java.lang.Long)
     */
    public int countOrgDemocracy(Integer year, Long userId) {
	Map map = new HashMap();
	map.put("year", year);
	map.put("userId", userId);
	return (Integer)getSqlMapClientTemplate().queryForObject("biz.countOrgDemocracy", map);
    }

 
}
